import 'package:flutter/material.dart';

import 'package:junyeyishu/utils/utils.dart';
import 'package:junyeyishu/widgets/QGButton.dart';

class QGOpenWalletWidget extends StatefulWidget {
  Function() onTap;
  QGOpenWalletWidget({super.key, required this.onTap});
  @override
  State<QGOpenWalletWidget> createState() => _QGOpenWalletWidgetState();

  static show(context, onTap) {
    showDialog(
        useSafeArea: false,
        context: context,
        builder: (context) {
          return QGOpenWalletWidget(onTap: onTap);
        });
  }
}

class _QGOpenWalletWidgetState extends State<QGOpenWalletWidget> {
  @override
  Widget build(BuildContext context) {
    return Column(
      mainAxisAlignment: MainAxisAlignment.end,
      children: [
        Container(
          padding: EdgeInsets.symmetric(horizontal: 20.rpx, vertical: 25.rpx),
          decoration: BoxDecoration(
            borderRadius: BorderRadius.only(
              topLeft: Radius.circular(20.rpx),
              topRight: Radius.circular(20.rpx),
            ),
            color: Color(0xFF192126),
          ),
          child: Column(
            children: [
              Text(
                '支付',
                style: TextStyle(
                    color: Color(0xFFffffff),
                    fontSize: 16.rpx,
                    fontWeight: FontWeight.normal),
              ),
              SizedBox(height: 35.rpx),
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Row(
                    children: [
                      // QGImage(asset: "test", width: 24.rpx, height: 24.rpx),
                      SizedBox(width: 10.rpx),
                      Text(
                        '汇付支付',
                        style: TextStyle(
                            color: Color(0xFFffffff),
                            fontSize: 14.rpx,
                            fontWeight: FontWeight.normal),
                      ),
                    ],
                  ),
                  TextButton(
                    onPressed: widget.onTap,
                    child: Container(
                      padding: EdgeInsets.symmetric(
                          vertical: 10.rpx, horizontal: 16.rpx),
                      decoration: BoxDecoration(
                        gradient: const LinearGradient(
                          begin: Alignment.centerLeft,
                          end: Alignment.centerRight,
                          colors: [Color(0xFF4AE3FF), Color(0xFF44FFF0)],
                        ),
                        borderRadius: BorderRadius.circular(34.rpx),
                      ),
                      child: Text(
                        '立即开通',
                        style: TextStyle(
                            color: Color(0xff111111),
                            fontSize: 12.rpx,
                            fontWeight: FontWeight.normal),
                      ),
                    ),
                  )
                ],
              ),
              SizedBox(height: 20.rpx),
              QGButton(title: "去支付"),
            ],
          ),
        ),
      ],
    );
  }
}
